package com.retailshop.shopuser.UserTask;

import com.retailshop.shopuser.common.MessageConstants;
import com.retailshop.shopuser.common.Response;
import com.retailshop.shopuser.service.OperatorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
public class OperatorAuto {

    @Autowired
    OperatorService operatorService;

    @ResponseBody
    @RequestMapping(value = "/Operator")
    public Response Operator(HttpServletRequest request) {
        if(operatorService.Operator()) {
            return new Response(MessageConstants.MSG_SUCCESS, null, 1, "", request);
        }
        else
        {
            return new Response(MessageConstants.MSG_ACCESS_DENY, null, 0, "执行错误", request);
        }
    }

    @ResponseBody
    @RequestMapping(value = "/Operatorsettlement")
    public Response Operatorsettlement(HttpServletRequest request) {
        if(operatorService.Operatorsettlement()) {
            return new Response(MessageConstants.MSG_SUCCESS, null, 1, "", request);
        }
        else
        {
            return new Response(MessageConstants.MSG_ACCESS_DENY, null, 0, "执行错误", request);
        }
    }

}
